<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="author"/>
    <title>Document</title>
    <style>
        div{
            margin:0 auto;
            width: 500px;
        }
        #jumpTo{
            color: red;
            font-size: 30px;
        }
    </style>
</head>

<body>
    <div>
        <h2>恭喜您，支付成功</h2>
        <span id="jumpTo">10</span>秒后自动返回首页
        <p><button>立即返回</button></p>
    </div>
    <script>
        // 逻辑：加载页面时，应该触发定时器 10s
        window.onload = function(){
            let timer = 10;
            setInterval(()=>{
                timer--;
                document.getElementById('jumpTo').innerText = timer;
                if(timer==0){
                    location.href = '选座购票.html';
                }
            },1000);
        }
        document.getElementsByTagName('button')[0].onclick = function(){
            location.href = '选座购票.html';
        }
    </script> 
</body>

</html>